<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!doctype html>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html class="no-js">
<head>
<script type="text/javascript">
$(function(){
	$("#addOrUpdateUserForm").validate({
		submitHandler:function(form){
			$ajax({
				url:"/user/saveUser",
				data:$formParams("addOrUpdateUserForm"),
				success:function(r){
					if(r && r.success) {
						$msgDialog(r.msg);
						$reloadTable("userTable");
						dialog.get("editUserDialog").close();
					}
				}
			});
		}
	});
});
</script>
</head>
<body>
	<form class="am-form am-form-horizontal" id="addOrUpdateUserForm">
		<input type="hidden" name="id" value="${user.id }" />
		<div class="am-form-group">
			<label for="name" class="am-u-sm-2 am-form-label">姓名:</label>
			<div class="am-u-sm-10">
				<input type="text" id="name" name="name" placeholder="输入名称" class="required" maxlength="100" value="${user.name }">
			</div>
		</div>
		<div class="am-form-group">
			<label for="name" class="am-u-sm-2 am-form-label">帐号:</label>
			<div class="am-u-sm-10">
				<input type="text" id="regname" <c:if test="${user.id != null}">disabled="disabled"</c:if> name="regname" placeholder="输入帐号" class="required" maxlength="100" value="${user.regname }">
			</div>
		</div>
		
		<div class="am-form-group">
			<label for="password" class="am-u-sm-2 am-form-label">密码:</label>
			<div class="am-u-sm-10">
				<input type="password" <c:if test="${user.id != null}">disabled="disabled"</c:if> id="password" name="password" placeholder="输入密码" class="required" maxlength="100" value="${user.password }">
			</div>
		</div>
		
		<div class="am-form-group">
			<label for="job" class="am-u-sm-2 am-form-label">职务:</label>
			<div class="am-u-sm-10">
				<input type="text" id="job" name="job" placeholder="输入职务" class="required" maxlength="100" value="${user.job }">
			</div>
		</div>
		<div class="am-form-group">
			<label for="email" class="am-u-sm-2 am-form-label">邮箱:</label>
			<div class="am-u-sm-10">
				<input type="text" id="email" name="email" placeholder="输入邮箱" class="required" maxlength="100" value="${user.email }">
			</div>
		</div>
		<div class="am-form-group">
			<label for="remark" class="am-u-sm-2 am-form-label">简介:</label>
			<div class="am-u-sm-10">
				<textarea rows="5" cols="20" name="remark" placeholder="输入简介" maxlength="200">${user.remark }</textarea>
			</div>
		</div>
		<div class="am-form-group">
			<label for="content" class="am-u-sm-2 am-form-label"></label>
			<div class="am-u-sm-10">
				<input type="submit" class="am-btn am-btn-default" value="确定">
			</div>
		</div>
	</form>
</body>
</html>